/**
 * Copyright (c) 2017-2022 Rushang Co.Ltd All Rights Reserved.
 */
package com.rshang.rsdp.router;

import com.rshang.rsdp.kit.StrKits;
import com.rshang.rsdp.service.ITbUserService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 功能简介：用户路由<br/>
 *
 * @author zhangjun
 * @create 2017年8月10日下午10:09:37
 */
@Controller
@RequiresRoles("管理员")
@RequestMapping("/system/user")
public class UserRouter extends BaseRouter {

    @Autowired
    ITbUserService userService;

    /**
     * 用户首页
     */

    @RequestMapping("")
    public ModelAndView index() {
        return new ModelAndView("system/user_index");
    }

    /**
     * 新增用户
     */
    @RequestMapping("/add")
    public ModelAndView add() {
        return new ModelAndView("system/user_add");
    }

    /**
     * 用户编辑
     */
    @RequestMapping("/edit")
    public ModelAndView edit() {
        ModelAndView view = new ModelAndView("system/user_edit");
        view.addObject("result", userService.get(StrKits.emptyToStr(request.getParameter("id"))));
        return view;
    }


}
